<template>
    <div id="temp">
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="(item,index) in newsList" :key="index">
                <router-link v-bind="{to:'newsinfo/'+item.id}">
                    <img class="mui-media-object mui-pull-left" :src="item.img_url">
                    <div class="mui-media-body">
                        {{item.title}}
                        <p class='mui-ellipsis'>{{item.zhaiyao}}</p>
                        <div class="bottomText">
                            <span>发表时间:{{item.add_time | datefmt("YYYY-MM-DD HH:mm:ss")}}</span>
                            <br>
                            <span>点击量:{{item.click}}</span>
                        </div>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>
<script>

//导入全局域名
import common from '../../kits/common.js';

//导入提示小组件
import { Toast } from 'mint-ui';

export default {
    data() {
        return {
            newsList: []
        }
    },
    created() {
        this.getNewsList();
    },
    methods: {
        getNewsList() {
            this.$http.get(common.urlHost + "/api/getnewslist")
                .then(function (res) {
                    if (res.body.status != 0) {
                        Toast({
                            message: res.body.message,
                            duration: 3000
                        });
                        return
                    }
                    this.newsList = res.body.message;
                })
        }
    }
}
</script>
<style scoped>
.mui-table-view img {
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    line-height: 80px;
}

.bottomText {
    margin-top: 1em;
    color: skyblue;
    font-size: 12px;
}

</style>


